export function getStorage(key) {
	return uni.getStorageSync(key)
}

export function setStorage(key, value) {
	return uni.setStorageSync(key, value);
}

export function removeStorage(key) {
	return uni.removeStorageSync(key);
}

export function clearStorage() {
	return uni.clearStorage();
}

export function messageSuccess(text) {
	const obj = {
		msgType: 'success',
		messageText: text
	}
	return obj;
}

export function messageError(text) {
	const obj = {
		msgType: 'error',
		messageText: text
	}
	return obj;
}

export function isLogin() {
	const uid = uni.getStorageSync('uid')
	const token = uni.getStorageSync('token')
	const isLogin = uni.getStorageSync('isLogin')
	if(uid === '' | uid === undefined || token === '' || token ===undefined || isLogin === '' || isLogin === undefined){
		return false
	}
	return true;
}

export function formatNum(obj) {
	obj.payTime /= 1000 
	return obj;
}

export default {
	getStorage,
	setStorage,
	removeStorage,
	clearStorage,
	messageSuccess,
	messageError,
	isLogin,
	formatNum
}